package com.gateon.cg.factory;


import com.gateon.cg.bean.Conf;
import com.gateon.cg.creator.FileCreator;
import com.gateon.cg.creator.impl.*;

/**
 * 生成代码
 */
public class SimpleFactory {
    private SimpleFactory() {
        super();
    }

    public static FileCreator create(String module, Conf conf) {

        FileCreator creator = null;
        if (module.equals("bean")) {
            creator = BeanClassCreator.getInstance(conf);
        } else if (module.equals("controller")) {
            creator = ControllerClassCreator.getInstance(conf);
        } else if (module.equals("service")) {
            creator = ServiceClassCreator.getInstance(conf);
        } else if (module.equals("impl")) {
            creator = ServiceImplClassCreator.getInstance(conf);
        } else if (module.equals("mapper")) {
            creator = MapperClassCreator.getInstance(conf);
        } else if (module.equals("xml")) {
            creator = MapperXmlCreator.getInstance(conf);
        }  else if ("resp".equals(module)){
            creator = RespCalssCreator.getInstance(conf);
        } else if ("req".equals(module)) {
            creator = ReqCalssCreator.getInstance(conf);
        } else if ("client".equals(module)){
            creator = ClientClassCreator.getInstance(conf);
        } else if ("provider".equals(module)) {
            creator = ProviderClassCreator.getInstance(conf);
        }
        return creator;

    }
}
